
function! autostart#setup_python() 
	let python3_candidates = expand('C:\Programs\Python\**\python3*.dll', v:false, v:true)
	let python3_candidates = add(python3_candidates, 'C:\Programs\scoop\apps\python\3.12.0\python3.dll')
	let python3_candidate_index = 0
	while !has('python3') && python3_candidate_index < len(python3_candidates)
		let &pythonthreedll = python3_candidates[python3_candidate_index]
		let python3_candidate_index = python3_candidate_index + 1
	endwhile
endfunction

function! autostart#on_enter() 
	syntax on
	" Options:
	set ambiwidth=double
	set backupdir=$TEMP
	set conceallevel=1
	set encoding=utf-8
	set fileencodings=ucs-bom,utf-8,gb18030,euc-jp
	set fdm=indent
	set hidden
	set number
	set noundofile
	set nobackup
	set noswapfile
	" set rnu
	set relativenumber
	set shiftwidth=4
	set smartindent
	set tabstop=4
	set termencoding=utf-8
	set visualbell
	call autostart#setup_python() 
	Startify
endfunction

" gui enter
function! autostart#set_font()
	let font_candidates = [
				\ 'Iosevka_Fixed_Extended:h14:cANSI:qDRAFT',
				\ 'CaskaydiaMono_NFM:h14:cANSI:qDRAFT',
				\ '等距更纱黑体_SC:h14:cGB2312:qDRAFT',
				\ 'Cascadia_Mono:h14:cANSI:qDRAFT',
				\ 'Lucida_Console:h14:cANSI:qDRAFT'
				\]
	let font_selected_index = 0
	let font_selected = ''
	while empty(font_selected) && font_selected_index < len(font_candidates)
		try
			let font_selected = font_candidates[font_selected_index]
			let &gfn = font_selected
		catch
			let font_selected = ''
			let font_selected_index = font_selected_index + 1
		endtry
	endwhile
endfunction

function! autostart#on_gui() 
	set background=dark
	" set guioptions-=m
	" set guioptions-=T
	set guioptions=egrL
	if exists('&smoothscroll')
		set smoothscroll
	endif
	call autostart#set_font()
	" set guifontwide=SimHei
	" AirlineRefresh
endfunction


